package com.sgg.springbootsgg001demo.config;

import com.sgg.springbootsgg001demo.bean.Pig;
import com.sgg.springbootsgg001demo.bean.Sheep;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@EnableConfigurationProperties(Sheep.class)
@Configuration   // 标识为一个配置类  会自动交给容器管理
public class Appconfig3 {
    @ConfigurationProperties(prefix = "pig")   // 需要先将修饰的类交给spring 容器管理
    @Bean("pig")
    public Pig pig() {
        return new Pig();
    }

}
